﻿using System;
using System.Net.Mail;
using System.Reflection;
using System.Text;

namespace eCommerce.BusinessLogic
{
    public class ContactFormBL
    {
        public void SendTechError(DateTime userTime, string userPage, string compWebsite, string compSubject, string userEmail, string error1, string error2, MethodBase error3)
        {
            MailAddress from3 = new MailAddress("techError@" + compWebsite);
            MailAddress to3 = new MailAddress("tavis@2beknown.co.uk");
            MailMessage message2 = new MailMessage(from3, to3);
            message2.Subject = compSubject;
            StringBuilder sb2 = new StringBuilder();
            sb2.Append("" + userTime + "<br /><br />");
            sb2.Append("Page:" + userPage + "<br /><br /><br />");
            sb2.Append("User Email:" + userEmail + "<br /><br /><br />");
            sb2.Append("Error Message:" + error1 + "<br /><br /><br />");
            sb2.Append("Stack Trace:" + error2 + "<br /><br /><br />");
            sb2.Append("Target Site:" + error3 + "<br />");
            message2.Body = sb2.ToString();
            message2.IsBodyHtml = true;
            SmtpClient smtp2 = new SmtpClient("localhost", 25);
            smtp2.Send(message2);
          

        }
    }
}
